package com.joseph.websocket.nio;


import java.io.IOException;
import java.io.InputStream;
import java.net.InetSocketAddress;
import java.net.Socket;

public class BIOClient {

    public static void main(String[] args) throws IOException {
        Socket socket = new Socket();
        socket.connect(new InetSocketAddress("localhost", 8888));
        socket.setSoTimeout(3000);
        socket.getOutputStream().write("JACK".getBytes());
        InputStream inputStream = socket.getInputStream();
        byte[] data = new byte[1024];
        while ((inputStream.read(data)) != -1) {
            break;
        }
        System.out.println(new String(data));
    }
}
